home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / makeindex / scanst.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-04-26  |  4.5 KB  |  191 lines

  1. /*
  2.  *
  3.  * Copyright (C) 1987     Pehong Chen    (phc@renoir.berkeley.edu)
  4.  * Computer Science Division
  5.  * University of California at Berkeley
  6.  *
  7.  */
  8.  
  9. #define    COMMENT            '%'
  10. #define    STR_DELIM        '"'
  11. #define    CHR_DELIM        '\''
  12.  
  13. #define    KEYWORD            "keyword"
  14. #define    AOPEN            "arg_open"
  15. #define    ACLOSE            "arg_close"
  16. #define ROPEN            "range_open"
  17. #define RCLOSE            "range_close"
  18. #define LEVEL            "level"
  19. #define QUOTE            "quote"
  20. #define ACTUAL            "actual"
  21. #define ENCAP            "encap"
  22. #define ESCAPE            "escape"
  23.  
  24. #define    IDX_KEYWORD        "\\indexentry"
  25. #define    IDX_AOPEN        '{'
  26. #define    IDX_ACLOSE        '}'
  27. #define    IDX_ROPEN        '('
  28. #define    IDX_RCLOSE        ')'
  29. #define    IDX_LEVEL        '!'
  30. #define IDX_QUOTE        '"'
  31. #define    IDX_ACTUAL        '@'
  32. #define    IDX_ENCAP        '|'
  33. #define    IDX_ESCAPE        '\\'
  34.  
  35. #define    COMPOSITOR        "page_compositor"
  36. #define    COMPOSITOR_DEF        "-"
  37. #define    PRECEDENCE        "page_precedence"
  38. #define    PRECEDENCE_DEF        "rnaRA"
  39. #define ROMAN_LOWER        'r'
  40. #define ROMAN_UPPER        'R'
  41. #define ARABIC            'n'
  42. #define ALPHA_LOWER        'a'
  43. #define ALPHA_UPPER        'A'
  44. #define ROMAN_LOWER_OFFSET    10000
  45. #define ROMAN_UPPER_OFFSET    10000
  46. #define ARABIC_OFFSET        10000
  47. #define ALPHA_LOWER_OFFSET    26
  48. #define ALPHA_UPPER_OFFSET    26
  49.  
  50. #define PREAMBLE        "preamble"
  51. #define PREAMBLE_DEF        "\\begin{theindex}\n"
  52. #define PREAMBLE_LEN        1
  53. #define    POSTAMBLE        "postamble"
  54. #define    POSTAMBLE_DEF        "\n\n\\end{theindex}\n"
  55. #define    POSTAMBLE_LEN        3
  56.  
  57. #define    SETPAGEOPEN        "setpage_prefix"
  58. #define    SETPAGECLOSE        "setpage_suffix"
  59.  
  60. #if    KCC_20
  61. /* KCC preprocessor bug collapses multiple blanks to single blank */
  62. #define    SETPAGEOPEN_DEF        "\n\040\040\\setcounter{page}{"
  63. #else
  64. #define    SETPAGEOPEN_DEF        "\n  \\setcounter{page}{"
  65. #endif
  66.  
  67. #define    SETPAGECLOSE_DEF    "}\n"
  68. #define    SETPAGE_LEN        2
  69.  
  70. #define    GROUP_SKIP        "group_skip"
  71.  
  72. #if    KCC_20
  73. /* KCC preprocessor bug collapses multiple blanks to single blank */
  74. #define    GROUPSKIP_DEF        "\n\n\040\040\\indexspace\n"
  75. #else
  76. #define    GROUPSKIP_DEF        "\n\n  \\indexspace\n"
  77. #endif
  78.  
  79. #define    GROUPSKIP_LEN        3
  80. #define    LETHEAD_PRE        "lethead_prefix"
  81. #define    LETHEADPRE_DEF        ""
  82. #define    LETHEADPRE_LEN        0
  83. #define    LETHEAD_SUF        "lethead_suffix"
  84. #define    LETHEADSUF_DEF        ""
  85. #define    LETHEADSUF_LEN        0
  86. #define    LETHEAD_FLAG        "lethead_flag"
  87. #define    LETHEADFLAG_DEF        0
  88.  
  89. #define    ITEM_0            "item_0"
  90. #define    ITEM_1            "item_1"
  91. #define    ITEM_2            "item_2"
  92. #define    ITEM_01            "item_01"
  93. #define    ITEM_x1            "item_x1"
  94. #define    ITEM_12            "item_12"
  95. #define    ITEM_x2            "item_x2"
  96.  
  97. #if    KCC_20
  98. /* KCC preprocessor bug collapses multiple blanks to single blank */
  99. #define    ITEM0_DEF        "\n\040\040\\item\040"
  100. #define    ITEM1_DEF        "\n\040\040\040\040\\subitem\040"
  101. #define    ITEM2_DEF        "\n\040\040\040\040\040\040\\subsubitem\040"
  102. #else
  103. #define    ITEM0_DEF        "\n  \\item "
  104. #define    ITEM1_DEF        "\n    \\subitem "
  105. #define    ITEM2_DEF        "\n      \\subsubitem "
  106. #endif
  107.  
  108. #define    ITEM_LEN        1
  109.  
  110. #define    DELIM_0            "delim_0"
  111. #define    DELIM_1            "delim_1"
  112. #define    DELIM_2            "delim_2"
  113. #define    DELIM_N            "delim_n"
  114. #define    DELIM_R            "delim_r"
  115. #define    DELIM_DEF        ", "
  116. #define    DELIMR_DEF        "--"
  117.  
  118. #define    ENCAP_0            "encap_prefix"
  119. #define    ENCAP_1            "encap_infix"
  120. #define    ENCAP_2            "encap_suffix"
  121. #define    ENCAP0_DEF        "\\"
  122. #define    ENCAP1_DEF        "{"
  123. #define    ENCAP2_DEF        "}"
  124.  
  125. #define LINEMAX            "line_max"
  126. #define INDENT_SPACE        "indent_space"
  127. #define INDENT_LENGTH        "indent_length"
  128. #define INDENTSPC_DEF        "\t\t"
  129. #define INDENTLEN_DEF        16
  130.  
  131. #define STY_ERROR(F, D) { \
  132.     if (idx_dot) { \
  133.         fprintf(ilg_fp, "\n"); \
  134.         idx_dot = FALSE; \
  135.     } \
  136.     fprintf(ilg_fp, "** Input style error (file = %s, line = %d):\n   -- ", \
  137.             sty_fn, sty_lc); \
  138.     fprintf(ilg_fp, F, D); \
  139.     sty_ec++; \
  140.     put_dot = FALSE; \
  141. }
  142.  
  143. #if    KCC_20
  144. /* KCC preprocessor bug collapses multiple blanks to single blank */
  145. #define    STY_ERROR2(F, D1, D2) { \
  146.      if (idx_dot) { \
  147.         fprintf(ilg_fp, "\n"); \
  148.         idx_dot = FALSE; \
  149.     } \
  150.     fprintf(ilg_fp, "** Input style error (file = %s, line = %d):\n\040\040 -- ", \
  151.             sty_fn, sty_lc); \
  152.     fprintf(ilg_fp, F, D1, D2); \
  153.     sty_ec++; \
  154.     put_dot = FALSE; \
  155. }
  156. #else
  157. #define    STY_ERROR2(F, D1, D2) { \
  158.      if (idx_dot) { \
  159.         fprintf(ilg_fp, "\n"); \
  160.         idx_dot = FALSE; \
  161.     } \
  162.     fprintf(ilg_fp, "** Input style error (file = %s, line = %d):\n   -- ", \
  163.             sty_fn, sty_lc); \
  164.     fprintf(ilg_fp, F, D1, D2); \
  165.     sty_ec++; \
  166.     put_dot = FALSE; \
  167. }
  168. #endif
  169.  
  170. #define STY_DOT    { \
  171.     idx_dot = TRUE; \
  172.     if (verbose) \
  173.         fprintf(stderr, DOT); \
  174.     fprintf(ilg_fp, DOT); \
  175. }
  176.  
  177. #define    STY_SKIPLINE { \
  178.     while (GET_CHAR(sty_fp) != LFD); \
  179.     sty_lc++; \
  180. }
  181.  
  182. #define SCAN_NO(N) { \
  183.     fscanf(sty_fp, "%d", N); \
  184. }
  185.  
  186. #define MULTIPLE(C) { \
  187.     STY_SKIPLINE; \
  188.     STY_ERROR2("Multiple instances of type `%c' in page precedence specification `%s'.\n", C, page_prec); \
  189.     return (FALSE); \
  190. }
  191.